﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using StyleMVVM.DependencyInjection;
using StyleMVVM.Validation;

namespace StyleMVVM.MVC.Validation
{
	[Export(typeof(ModelValidatorProvider))]
	public class StyleMVVMValidatorProvider : ModelValidatorProvider
	{
		private IValidationService validationService;

		[ImportConstructor]
		public StyleMVVMValidatorProvider(IValidationService validationService)
		{
			this.validationService = validationService;
		}

		public override IEnumerable<ModelValidator> GetValidators(ModelMetadata metadata, ControllerContext context)
		{
			return new [] { new StyleMVVMValidator(validationService, metadata, context) };
		}
	}
}